package org.example.MedicalCrowdsourcing.repository;

import org.example.MedicalCrowdsourcing.model.entity.BlockchainProject;
import org.example.MedicalCrowdsourcing.model.entity.BlockchainTransaction;
import org.example.MedicalCrowdsourcing.model.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.math.BigInteger;
import java.util.List;
import java.util.Optional;

@Repository
public interface BlockchainTransactionRepository extends JpaRepository<BlockchainTransaction, Long> {
    List<BlockchainTransaction> findByProject(BlockchainProject project);
    List<BlockchainTransaction> findByProjectOrderByCreatedAtDesc(BlockchainProject project);
    Optional<BlockchainTransaction> findByTransactionHash(String transactionHash);
    Optional<BlockchainTransaction> findByBlockchainId(BigInteger blockchainId);
    List<BlockchainTransaction> findByCreator(User creator);
} 